package com.charles.enums;

import lombok.Getter;

/**
 * @author charles
 * @date 2022/9/5 15:05
 */
@Getter
public enum BusinessType {
    WEB(1, "web"),
    API(2, "api");

    BusinessType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    private Integer code;

    private String name;

    public static BusinessType getUrlSource(String name) {
        for (BusinessType businessType : BusinessType.values()) {
            if (businessType.getName().equals(name)) {
                return businessType;
            }
        }
        return BusinessType.API;
    }

}
